//
//  DYNetworkDelegate.h
//  Pods
//
//  Created by LXF on 16/6/30.
//
//

#import "XXNetworkDelegate.h"
@class DYAccountProxy;

typedef id(^ParseResponsByTargetHandle)(id res,NSError **serializationError,id mark);

@interface DYNetworkDelegate : XXNetworkDelegate

@property (nonatomic, strong) DYAccountProxy *accountProxy;

// keyPath 是否必须有值,如果设置为 NO,则允许为 没有值
@property (nonatomic, assign) BOOL keyPathNeedful;

@property (nonatomic, copy) ParseResponsByTargetHandle parseResponsByTargetData;
@property (nonatomic, copy) ParseResponsByTargetHandle parseTargetDataToTarget;

-(void)setParseTargetDataToTarget:(ParseResponsByTargetHandle)parseTargetDataToTarget;
-(void)setParseResponsByTargetData:(ParseResponsByTargetHandle)parseResponsByTargetData;

// 自动转化 不是很安全 根据 服务器返回的对象进行转化,如果返回 dict -> 单个对象  list -> 对象数组
-(instancetype)autoTo:(Class)clazz keyPath:(NSString *)keyPath;
-(instancetype)autoTo:(Class)clazz keys:(NSArray<NSString *> *)keys;

/// 自动转化为 单个对象
-(instancetype)autoToAny:(Class)clazz keyPath:(NSString *)keyPath;
-(instancetype)autoToAnyList:(Class)clazz keyPath:(NSString *)keyPath;

/// 自动转化为 对象数组
-(instancetype)autoToAny:(Class)clazz keys:(NSArray<NSString *> *)keys;
-(instancetype)autoToAnyList:(Class)clazz keys:(NSArray<NSString *> *)keys;

-(instancetype)encryption1WithKeyByPassword;
-(instancetype)encryption2WithKeyByPassword;

-(instancetype)encryption1WithKeys:(NSArray *)keys;
-(instancetype)encryption2WithKeys:(NSArray *)keys;

@end
